package com.example.garbage.controller;

import com.example.garbage.pojo.Buildings;
import com.example.garbage.pojo.RespBean;
import com.example.garbage.service.BuildingsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author Shunrai
 * @create 2024/3/28 13:11
 * @Version 1.0
 * @Description
 */
@RestController
@RequestMapping("/buildings")
@ApiResponse(responseCode = "404", description = "查询失败")
@ApiResponse(responseCode = "200", description = "查询成功")
@Tag(name = "建筑物")
public class BuildingController {
    @Autowired
    private BuildingsService buildingsService;

    @GetMapping("/getAll")
    @Operation(summary = "获取所有建筑物")
    public RespBean<Buildings> getAll(){
        List<Buildings> list = buildingsService.list();
        return RespBean.success("查询成功",list);
    }
}
